package com.it.exception;

import com.it.util.Result;
import org.springframework.http.HttpStatus;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.ResponseStatus;
import org.springframework.web.bind.annotation.RestControllerAdvice;

/**
 * 全局异常处理程序
 *
 * @author 16272
 * @date 2023/09/23
 */

@RestControllerAdvice
public class GlobalExceptionHandler {

    @ExceptionHandler(GeneralException.class)
    public Result<String> exceptionHandle(GeneralException ex){
        return Result.buildFail(ex.getMessage(),ex.getCode());
    }
}
